package com.juner.service;

import com.juner.api.enums.StrategyEnum;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
 * @author DengJunPeng
 * @effect:
 * @e-mail 3335056441@qq.com
 * @date 2024/10/13 20:24
 */
@Service
public class StrategyExecuteServiceImpl {

    public void strategyTest(String type) {
        Optional.ofNullable(StrategyEnum.getEnumWithValue(type))
                .map(StrategyEnum::getEnumStrategyService)
                .ifPresent(strategyService -> strategyService.execute());
    }
}
